/**
 * 
 */
package idv.takeshi.software.productline.bookstore.application.service;

import idv.takeshi.software.productline.bookstore.application.service.dto.PaymentDto;
import idv.takeshi.software.productline.bookstore.domain.model.order.Order;
import idv.takeshi.software.productline.bookstore.domain.model.order.OrderStatus;
import idv.takeshi.software.productline.bookstore.domain.model.order.OrderStatusToUnderProcessingException;
import idv.takeshi.software.productline.bookstore.domain.model.useraccount.UserAccount;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

/**
 * A service interface for maintaining orders models operations.
 * @author takeshi
 *
 */
public interface MaintainOrdersService {
	
	/**
	 * Get order models by given criteria.
	 * @param userName
	 * @param recipientName
	 * @param orderStatus
	 * @param fromUpdateTime
	 * @param toUpdateTime
	 * @param fromCreateTime
	 * @param toCreateTime
	 * @param fromPrice
	 * @param toPrice
	 * @return
	 */
	public Set<Order> getOrders(String userName, String recipientName,
			OrderStatus orderStatus, Date fromUpdateTime, Date toUpdateTime,
			Date fromCreateTime, Date toCreateTime, BigDecimal fromPrice,
			BigDecimal toPrice);
	
	/**
	 * Get user account model by given order id.
	 * @param orderId
	 * @return
	 */
	public UserAccount getUserAccountByOrderId(Long orderId);
	
	
	/**
	 * Get order model by id.
	 * @param orderId
	 * @return
	 */
	public Order getOrderById(Long orderId);
	
	
	/**
	 * Update paymentDto by given DTO object.
	 * @param paymentDto
	 */
	public void updatePayment(PaymentDto paymentDto);
	
	/**
	 * Move the Order to next status, by given methodName to determine. 
	 * @param orderId
	 * @param methodName
	 * @throws OrderStatusToUnderProcessingException 
	 */
	public void goToNextStatus(Long orderId, String methodName) throws OrderStatusToUnderProcessingException;
	
	/**
	 * Cancel the Order.
	 * @param orderId
	 */
	public void cancelOrder(Long orderId);
}
